package pit.com.ordermobilesystem;

import pit.com.ordermobilesystem.constant.OrderConstant;
import android.app.Activity;
import android.content.DialogInterface;
import android.support.v4.app.Fragment;




public class BaseFragment extends Fragment implements OrderConstant{
	public String name="";
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	

	public enum TypeLoadingMore {
		NONE, LOADING_MORE, PULL_TO_REFRESH, LOADING_FIRST
	}
	
	/**
	 * @author NMTHONG
	 * @param title
	 * @param message
	 * @param onCancel
	 */
	public void showProgressDialog(DialogInterface.OnCancelListener onCancel) {
		Activity activity = getActivity();
		if (activity instanceof BaseFragmentInterface) {
			BaseFragmentInterface baseFrament = (BaseFragmentInterface) activity;
			baseFrament.showProgressDialog( onCancel);
		
		}
	}

	/**
	 * @author NMTHONG
	 * @since 17/5/2013
	 */
	public void hideProgressDialog() {
		Activity activity = getActivity();
		if (activity instanceof BaseFragmentInterface) {
			BaseFragmentInterface baseFrament = (BaseFragmentInterface) activity;
			baseFrament.hideProgressDialog();
		}
	}

	/**
	 * @author NMTHONG
	 * @since 17/5/2013
	 * @param title
	 * @param message
	 */
	public void showAlert(String title, String message) {
		Activity activity = getActivity();
		if (activity instanceof BaseFragmentInterface) {
			BaseFragmentInterface baseFrament = (BaseFragmentInterface) activity;
			baseFrament.showAlert(title, message);
		}
	}

	
	public void setTitle(String title){
		Activity activity = getActivity();
		if (activity instanceof ShopActivity) {
			ShopActivity shopActivity = (ShopActivity) activity;
			shopActivity.setTitleActionBar(title);
		}		
	}
	
	public void setTitle(int title){
		Activity activity = getActivity();
		if (activity instanceof ShopActivity) {
			ShopActivity shopActivity = (ShopActivity) activity;
			shopActivity.setTitleActionBar(title);
		}		
	}	
	
	
}
